package learn5exchange

import utils.RabbitMqUtils

class EmitLog {
    static final EXCHANGE_NAME = "logs"

    static void main(String[] args) {
        def channel = RabbitMqUtils.getChannel()
        channel.exchangeDeclare(EXCHANGE_NAME,"fanout")
        def scanner = new Scanner(System.in)
        while(scanner.hasNext()){
            channel.basicPublish(EXCHANGE_NAME,'',null,scanner.next().getBytes("UTF-8"))
//            println("消息发出：")
        }
    }
}
